import {
  request
} from './request'

//获取登录接口
export function getLogin(phone, password, captcha) {
  return request({
    url: '/login/cellphone',
    params: {
      phone,
      password,
      captcha
    }
  })
}

//获取用户信息
export function getUserInfo(uid) {
  return request({
    url: '/user/detail?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid
    }
  })
}


//查询用户私人歌单
export function getUserPrivatePlayList(uid) {
  return request({
    url: '/user/playlist?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid
    }
  })
}

//获取用户关注信息
export function getUserFollows(uid, limit, offset) {
  return request({
    url: '/user/follows?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid,
      limit,
      offset
    }
  })
}
//获取用户关注数量信息
export function getUserFollowsCount(uid, limit) {
  return request({
    url: '/user/follows?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid,
      limit
    }
  })
}

//获取用户粉丝信息
export function getUserFolloweds(uid, limit, offset) {
  return request({
    url: '/user/followeds?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid,
      limit,
      offset
    }
  })
}
//获取用户粉丝数量信息
export function getUserFollowedsCount(uid, limit) {
  return request({
    url: '/user/followeds?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid,
      limit
    }
  })
}

//关注用户
export function Follow(id, t) {
  return request({
    url: '/follow?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      id,
      t
    }
  })
}

//签到
export function signIn() {
  return request({
    url: '/daily_signin?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      type: 0
    }
  })
}

//编辑用户资料
export function UserEdit(gender,
  birthday,
  nickname,
  province,
  city,
  signature) {
  return request({
    url: '/user/update?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      gender,
      birthday,
      nickname,
      province,
      city,
      signature
    }
  })
}

//修改用户头像
export function EditCover(data) {
  return request({
    method:'post',
    url: '/avatar/upload?cookie=' + sessionStorage.getItem("cookie"),
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    data
  })
}

//获取验证码
export function getCaptcha(phone) {
  return request({
    url: '/captcha/sent?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      phone
    }
  })
}
//获取私信内容
export function getPrivate(limit, offset) {
  return request({
    url: '/msg/private?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      limit,
      offset
    }
  })
}

//发送私信
export function sendText(user_ids, msg) {
  return request({
    url: '/send/text?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      user_ids,
      msg
    }
  })
}


//获取用户私信内容
export function getUserPrivate(uid, limit, before) {
  return request({
    url: '/msg/private/history?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid,
      limit,
      before
    }
  })
}


//获取通知——评论内容
export function getUserComment(uid, limit, before) {
  return request({
    url: '/msg/comments?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      uid,
      limit,
      before
    }
  })
}

//获取通知——@我内容
export function getUserForwards(limit, offset) {
  return request({
    url: '/msg/forwards?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      limit,
      offset
    }
  })
}

//获取通知——通知内容
export function getUserNotices(limit, lasttime) {
  return request({
    url: '/msg/notices?cookie=' + sessionStorage.getItem("cookie"),
    params: {
      limit,
      lasttime
    }
  })
}

//乐签信息
export function getSignInfo() {
  return request({
    url: '/sign/happy/info?cookie=' + sessionStorage.getItem("cookie"),
    params: {
    }
  })
}

//刷新登录
export function refresh() {
  return request({
    url: 'login/refresh?cookie=' + sessionStorage.getItem("cookie"),
    params: {
    }
  })
}